from django.test import TestCase


# Create your tests here.
class Manager:

    def __init__(self, ):
        self.obj = None

    def next_handler(self, obj):
        self.obj = obj

    def handler(self, price):
        pass


class General(Manager):

    def handler(self, price):
        if price < 300000:
            print("{} 普通销售".format(price))
        else:
            self.obj.handler(price)


class Elite(Manager):

    def handler(self, price):
        if 300000 <= price < 800000:
            print("{} 精英销售".format(price))
        else:
            self.obj.handler(price)


class BOSS(Manager):

    def handler(self, price):
        if price >= 800000:
            print("{} 店长".format(price))


general = General()
elite = Elite()
boss = BOSS()

general.next_handler(elite)

elite.next_handler(boss)

prices = [550000, 220000, 1500000, 200000, 330000]
for price in prices:
    general.handler(price)
